//input to file

import java.io.*;
import java.util.*;

public class Main{
	public static void main(String[] args){
		try{
			BufferedReader bufferedreader=new BufferedReader(new InputStreamReader(System.in));
			BufferedWriter bufferedwriter=new BufferedWriter(new FileWriter(args[0]));
			String input=null;
			while(!(input=bufferedreader.readLine()).equals("quit")){
				bufferedwriter.write(input);
				bufferedwriter.newLine();
			}
	
			bufferedreader.close();
			bufferedwriter.close();

		}
		catch(ArrayIndexOutOfBoundsException e){
			e.printStackTrace();
		}
		catch(IOException e){
			e.printStackTrace();
		}
	}
}